﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Facade
{
    class EncryptFacade
    {
        // 封装底层组件
        private FileReader _fileReader;
        private CipherMachine _cipherMachine;
        private FileWriter _fileWriter;

        // 初始化组件
        public EncryptFacade()
        {
            _fileReader = new FileReader();
            _cipherMachine = new CipherMachine();
            _fileWriter = new FileWriter();
        }

        // 对外提供统一的加密流程接口
        public void Encrypt(string sourcePath, string targetPath)
        {
            string plainText = _fileReader.read(sourcePath);
            string encryptedText = _cipherMachine.encrypt(plainText);
            _fileWriter.write(encryptedText, targetPath);
        }
    }
}
